import { ref, computed } from 'vue'
import { defineStore } from 'pinia'

export const useMetaStore = defineStore('meta', () => {
  const metas = ref([])
  function setMeta(meta) {
    metas.value = meta
  }
  function getMeta() {
    return metas.value
  }
  return { metas, setMeta, getMeta }
})

export const userLoadingStore = defineStore('loading', () => {
  const loading = ref(false)
  function setLoading(val) {
    loading.value = val
  }
  return { loading, setLoading }
})

export const userTokenStore = defineStore('token',()=>{
  const token = ref(null)
  function setToken(value){
    token.value =value
  }
  function getToken(){
    return token.value
  }
  return { token,setToken,getToken }
},{
  persist:{
    storage:sessionStorage
  }
})
